Search this book | Previous | Table of contents | Next

WebRunner


If a copy of WebRunner is located on your computer, and you select a URL having the scheme "ascpt", then the data contained in the URL will be sent to your computer and run. Unlike CGI scripts run by the remote computer hosting the server, ascpt URLs are executed locally as the following link exemplifies. (You must have a copy of WebRunner on your computer before the script will work, and, until other Macintosh-based browsers mature, only the Netscape browser produces the desired effect.)

By the way, Alcuin was a Medieval librarian and advisor to Charlemagne.


Writing ascpt Scripts

The process of writing ascpt scripts is the same as writing any AppleScript scripts, except you must encode them before they can be added to your the URLs of your HTML documents. Unencoded, here is the AppleScript for the "Resurrect Alcuin" script above:
tell application "Netscape 1.1N"
     display dialog "MacAlcuin says, 'Hello, World. I'm alive!'" buttons {"OK"} default button {"OK"}
end tell
As you can see, this script simply tells the Netscape application to display a dialog box.

After you write your scripts making sure they run correctly and include plenty of error trapping, save the script as an ASCII text file. Next, drag the text file on to the WebRunner application. WebRunner will encode the script for you changing all the spaces, returns, colons, etc. to their proper escaped sequences. WebRunner will then copy your encoded script to the clipboard. From there, paste your script into a URL of an HTML document. This leads you to two big problems with WebRunner.


WebRunner Problem #1

There are two problems with WebRunner (ascpt) scripts. First, the AppleScript to be executed must be completely contained within a single URL with all HTML escape sequences encoded (return characters, colons, backslashes, greater than and less than signs, etc.). Watch out though! WebRunner does not automatically encode characters like less than (<), greater than (>), or ampersand (&), and if your script contains these characters, then you must encode them also, by hand.

Consequently, your HTML files are even more difficult to debug, read, and maintain. For example, below is the URL that was used to create the "Resurrect Alcuin" script above:

<A HREF="ascpt:tell%20application%20%22 Netscape%201.1N%22%0D%09display%20dialog %20%22MacAlcuin%20says,%20%27Hello, %20World.%20I%27m%20alive!%27%22%20 buttons%20{%22OK%22}%20default%20 button%20{%22OK%22}%0Dend%20tell%0D"> Resurrect Alcuin</A>
Yuck! Furthermore, these problematic URLs only get worse as the lengths of your scripts increase.


WebRunner Problem #2

More importantly, ascpt scripts represent a potential security risk. For example, a hapless WWW surfer like yourself may select an ascpt script that could do some potential harm to your computer:


Search this book | Previous | Table of contents | Next

Eric last edited this page on September 26, 1995. Please feel free to send comments.